<%-- 
    Document   : viewAccount
    Created on : Dec 19, 2014, 3:57:13 PM
    Author     : Jef
--%>
<%@page import="dao.ManagerDAO"%>
<%@page import="entity.Manager"%>
<%
    String username = (String) request.getSession().getAttribute("Username");
    String email = "";
    String password = "";
    Manager ma = ManagerDAO.getManagerInfo(username);
    String saveBtn = request.getParameter("saveBtn");
    if (saveBtn == null) {
        email = ma.getEmail().trim();
        password = ma.getPassword().trim();
    } else {
        email = request.getParameter("email");
        password = request.getParameter("password");
        ma.setEmail(email);
        ma.setPassword(password);
        ManagerDAO.edit(ma);
    }
%>
<jsp:include page="../header.jsp"></jsp:include>
<html>
    <head>
        <meta charset="utf-8">
        <title>Untitled Document</title>
    </head>

    <body>
        <div class="container">
            <h2>Account Management</h2>
            <hr>
            <form action="account.jsp?username=<%=username%>" method="POST">
                <table width="50%" style="border-collapse: separate; border-spacing: 20px">
                    <tr>
                        <td width="30%">&nbsp;</td>
                        <td width="70%">&nbsp;</td>
                    </tr>

                    <tr>
                        <td>Username </td>
                        <td><input name="username" type="text" class="form-control" value="<%=username%>" disabled=""/>
                        </td>
                    </tr>
                    <tr>
                        <td>Password </td>
                        <td><input name="password" type="text" class="form-control" value="<%=password%>" required/>
                        </td>
                    </tr>
                    <tr>
                        <td>Email(<font color="red">*</font>) </td>
                        <td><input name="email" type="text" class="form-control" value="<%=email%>" required/></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td><input name="saveBtn" type="submit" value="Save" class="btn btn-success" style="width: 100px"/></td>
                        <td><a href="../public/index.jsp"><input type="button" value="Cancel" class="btn btn-danger" style="width: 100px"/></a></td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>
<jsp:include page="../footer.jsp"></jsp:include>
